﻿/*
=============================================================================
Author:魏宝辉通过CodeSmithe生成
CreatedTime:2012-10-31
Description:Master三层结构数据访问层
=============================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using PWMIS.DataMap.Entity;
using FTchina.Models;//引入模型层
namespace FTchina.DAL
{
	public static partial class MasterService
	{
		 
	 
			
		public static int DeleteMasterById(int id)	
		{     
            Master master = new Master();
            master.Id = id;
            EntityQuery<Master> query = new EntityQuery<Master>(master);
             return query.Delete(master);
		}	
        
          //以标识列获得对象
        public static Master GetMasterById(int  id)
        {
            Master master = new Master();
            master.Id = id;
            EntityQuery<Master> query = new EntityQuery<Master>(master);
            query.FillEntity(master);
            return master;
        }
		
	 
	 
       
        
        
        
		 
		 
		 public static int AddOrUpdateMaster(Master master)
        {
            Master _master = new Master();

            EntityQuery<Master> query = new EntityQuery<Master>(_master);
           _master= master;
           int i=(master.Id==0)?
                 query.Insert(_master): query.Update(_master);
            return i;
        }
		
		 
	}
}

